<?
include('../ajax/sysData.php');
include('../ajax/ajaxContactForm.php');
include('../appInit.php');

// Populate Language select menu
$langSelect = getLanguages();

// Populate Ethnicity select menu
$ethSelect = getEthnicities();

// Populate Roles select menus
$roleParent       = getRoles('Parent','select',$_SESSION['org']);
$roleProfessional = getRoles('Professional','select',$_SESSION['org']);
$roleOther        = getRoles('Other','select',$_SESSION['org']);

$id       = $_POST[id];
$memberID = $_GET['memberID'];
if (empty($memberID)) {
	/*
	 * If we have just opened this tab, memberID should be 0
	 */
	$memberID = 0;
} else {
	$memberJSON  = getMemberInformation($memberID,$id,0,0,0);
	$memberArray = Zend_Json::decode($memberJSON);
	
	$nameFirst = $memberArray['FirstName'];
	$nameLast  = $memberArray['LastName'];
}
?>
		<input type="hidden" name="memberID<?=$id; ?>" id="memberID<?=$id; ?>" value="<?=$memberID; ?>" />
		<div id="tabHTMLDiv">
			<div class="tab-content">
				<div style="float: left; width: 160px;">
					<label class="vertLabelSmall">First Name</label>
					<input tabindex="11" type="text" style="width: 138px;" onBlur="contactFormSupportObj.updateTabTitle(<?=$id; ?>);" id="nameFirst<?=$id; ?>" /><br />
					<label class="vertLabelSmall">Zip Code</label>
					<input tabindex="13" type="text" id="zipCode<?=$id; ?>" style="width: 138px;" />
				</div>
				<div style="float: left; width: 160px;">
					<label class="vertLabelSmall">Last Name</label>
					<input tabindex="12" type="text" style="width: 138px;" onBlur="contactFormSupportObj.updateTabTitle(<?=$id; ?>);" id="nameLast<?=$id; ?>" />
					<div id="nameLastAutocompleter<?=$id; ?>" name="nameLastAutocompleterField<?=$id; ?>" class="autocomplete"></div>
					<label class="vertLabelSmall">Gender</label>
					<input tabindex="14" type="radio" name="memberGenderRadio" id="memberGenderMale<?=$id; ?>" /> <span>Male</span>
					<input tabindex="15" type="radio" name="memberGenderRadio" id="memberGenderFemale<?=$id; ?>" /> <span>Female</span>
					
				</div>
				<div style="float: left; width: 150px;">
					<label class="vertLabelSmall">Member Type</label>
					<input tabindex="16" style="margin: 2px;" type="checkbox" class="checkboxMemberType<?=$id; ?>" id="memberTypeChild<?=$id; ?>" value="Child" onClick="contactFormSupportObj.showMemberTypePanel('Child',<?=$id; ?>);" /> 
						<span><a href="#" id="linkMemberTypeChild<?=$id; ?>" onClick="contactFormSupportObj.showMemberTypePanel('Child',<?=$id; ?>); return false;">Child</a></span><br />
					<input tabindex="17" style="margin: 2px;" type="checkbox" class="checkboxMemberType<?=$id; ?>" id="memberTypeParent<?=$id; ?>" value="Parent" onClick="contactFormSupportObj.showMemberTypePanel('Parent',<?=$id; ?>);" /> 
						<span><a href="#" id="linkMemberTypeParent<?=$id; ?>" onClick="contactFormSupportObj.showMemberTypePanel('Parent',<?=$id; ?>); return false;">Parent</a></span><br /> 
					<input tabindex="18" style="margin: 2px;" type="checkbox" class="checkboxMemberType<?=$id; ?>" id="memberTypeProfessional<?=$id; ?>" value="Professional" onClick="contactFormSupportObj.showMemberTypePanel('Professional',<?=$id; ?>);" /> 
						<span><a href="#" id="linkMemberTypeProfessional<?=$id; ?>" onClick="contactFormSupportObj.showMemberTypePanel('Professional',<?=$id; ?>); return false;">Professional</a></span><br /> 
					<input tabindex="19" style="margin: 2px;" type="checkbox" class="checkboxMemberType<?=$id; ?>" id="memberTypeOther<?=$id; ?>" value="Other" onClick="contactFormSupportObj.showMemberTypePanel('Other',<?=$id; ?>);" /> 
						<span><a href="#" id="linkMemberTypeOther<?=$id; ?>" onClick="contactFormSupportObj.showMemberTypePanel('Other',<?=$id; ?>); return false;">Other</a></span><br /> 
				</div>
				<div style="float: left;" id="memberTypeOptionsContainer<?=$id; ?>">
					<!-- MemberTypeOptions -->
					<div id="memberTypeOptionPanels<?=$id; ?>">
						<div class="memberType<?=$id; ?>" id="panelChild<?=$id; ?>" style="display: none;">
							<label class="vertLabelSmall">Childs' Age or Date of Birth</label>					
						
							<div style="float: left;">
								<select id="childAgeYr<?=$id; ?>" style="width: 60px;" size="1">
								<option>Yr...</option>
								<?
							for($a=1;$a<=18;$a++) {
								echo '<option value="'.$a.'">'.$a.'</option>';
							}
							?>
							</select>
							<select id="childAgeMonth<?=$id; ?>" style="width: 60px;" size="1">
							<option>Mo...</option>
							<?
							for($a=1;$a<=11;$a++) {
								echo '<option value="'.$a.'">'.$a.'</option>';
							}
							?>
							</select>
						</div>
						<div style="float: left; margin-right: 5px; margin-left: 5px;">
							<input type="text" style="width: 100px;" id="dateFieldBirth<?=$id; ?>" />
							</div>
							<div style="clear: left;"></div>
						</div>
						
						<div class="memberType<?=$id; ?>" id="panelParent<?=$id; ?>" style="display: none;">
							<label class="vertLabelSmall">Parent Role</label>
							
							<select id="parentRole<?=$id; ?>" size="1" class="selectRole<?=$id; ?>" style="width: 140px;">
							<option>Select...</option>
							<option></option>
							<?=$roleParent; ?>
							</select>
						</div>
						
						<div class="memberType<?=$id; ?>" id="panelProfessional<?=$id; ?>" style="display: none;">
							<label class="vertLabelSmall">Professional Role</label>
							<!-- <input type="text" id="professionalRole<?=$id; ?>" class="selectRole<?=$id; ?>" style="width: 216px;" /> -->
							
							<select id="professionalRole<?=$id; ?>" size="1" class="selectRole<?=$id; ?>" style="width: 216px;">
							<option>Select...</option>
							<option></option>
							<?=$roleProfessional; ?>
							</select><br />
							<label class="vertLabelSmall">Organization</label>
							<input type="text" id="professionalOrg<?=$id; ?>" style="width: 210px;" /><br />	
							<label class="vertLabelSmall">Website URL</label>
							<input type="text" id="professionalURL<?=$id; ?>" style="width: 210px;" value="http://" />							
						</div>
						
						<div class="memberType<?=$id; ?>" id="panelOther<?=$id; ?>" style="display: none;">
							<label class="vertLabelSmall">Other Role</label>
							
							<select id="otherRole<?=$id; ?>" size="1" class="selectRole<?=$id; ?>" style="width: 140px;">
							<option>Select...</option>
							<option></option>
							<?=$roleOther; ?>
							</select>
						</div>
					</div>	
					<!-- End MemberTypeOptions -->
				</div>
		<div style="clear: left;"></div>
		<div style="height: 10px;"></div>
		
		<div style="float: left; width: 320px;">
			<label class="vertLabelSmall">Address</label>
			<input tabindex="20" type="text" id="address<?=$id; ?>" style="width: 285px;" />
		</div>				
		<div style="float: left; width: 155px;">
			<label class="vertLabelSmall">Primary Phone</label>
			<input tabindex="26" type="text" id="phone1<?=$id; ?>" style="width: 145px;" />
			<div id="phone1Autocompleter<?=$id; ?>" name="phone1AutocompleterField<?=$id; ?>" class="autocomplete"></div>
		</div>
		<div style="float: left; width: 155px;">
			<label class="vertLabelSmall">Phone 2</label>
			<input tabindex="27" type="text" id="phone2<?=$id; ?>" style="width: 145px;" />
		</div>
		<div style="clear: left;"></div>
		
		<div style="float: left; width: 320px;">
			<label class="vertLabelSmall">City</label>
			<input tabindex="21" type="text" id="city<?=$id; ?>" style="width: 285px;" />
		</div>				
		<div style="float: left; width: 320px;">
			<label class="vertLabelSmall">Email Address</label>
			<input tabindex="28" type="text" id="email<?=$id; ?>" style="width: 300px;" />
		</div>		
		<div style="clear: left;"></div>
		
		<div style="float: left; width: 320px;">
			<label class="vertLabelSmall">State</label>
			<select tabindex="22" id="state<?=$id; ?>" size="1" style="width: 160px;">
			<? include('includes/states.html'); ?>
			</select> 
		</div>							
		<div style="float: left; width: 320px;">
			<label class="vertLabelSmall">Primary Language</label>
			<select tabindex="29" id="selectLanguage<?=$id; ?>" size="1" style="width: 300px;">
			<option>Select...</option>
			<option></option>
			<?=$langSelect; ?>
			</select> 
		</div>				
		<div style="clear: left;"></div>				
		
		<div style="float: left; width: 320px;">
			<label class="vertLabelSmall">County</label>
			<select tabindex="23" id="selectCounty<?=$id; ?>" size="1" style="width: 290px;">
			<option>Select...</option>
			<option></option>
			<? include('includes/countiesOregon.html'); ?>
			</select> 
		</div>		
		<div style="float: left; width: 320px;">
			<label class="vertLabelSmall">Ethnicity</label>
			<select tabindex="30" id="selectEthnicity<?=$id; ?>" size="1" style="width: 300px;">
			<option>Select...</option>
			<option></option>
			<?=$ethSelect; ?>
			</select> 
		</div>	
		<div style="clear: left; height: 15px;"></div>
		
		<div style="float: left; width: 320px;">
			<label class="vertLabelSmall">Name of School</label>
			<input tabindex="24" type="text" id="nameOfSchool<?=$id; ?>" style="width: 285px;" />
		</div>		
		<div style="float: left; width: 350px;">
			<label style="margin-bottom: 7px;" class="vertLabelSmall">Type of School</label>
			<input tabindex="31" class="radioSchoolType<?=$id; ?>" type="radio" name="schoolType" id="schoolTypePublic<?=$id; ?>" value="Public" /> <span>Public</span>
			<input tabindex="32" class="radioSchoolType<?=$id; ?>" type="radio" name="schoolType" id="schoolTypePrivate<?=$id; ?>" value="Private" /> <span>Private</span>
			<input tabindex="33" class="radioSchoolType<?=$id; ?>" type="radio" name="schoolType" id="schoolTypeHome<?=$id; ?>" value="Home" /> <span>Home School</span>
			<input tabindex="34" class="radioSchoolType<?=$id; ?>" type="radio" name="schoolType" id="schoolTypeCharter<?=$id; ?>" value="Charter" /> <span>Charter</span>
			<input tabindex="35" class="radioSchoolType<?=$id; ?>" type="radio" name="schoolType" id="schoolTypeNone<?=$id; ?>" value="" checked /> <span>None / NA</span>					
		</div>
		<div style="clear: left;"></div>
		
		<div style="float: left; width: 320px;">
			<label style="margin-bottom: 7px;" class="vertLabelSmall">School District</label>
			<input type="text" style="width: 275px;" tabindex="25" id="selectSchoolDistrict<?=$id; ?>" name="selectSchoolDistrict<?=$id; ?>" />
			
			<!-- 
			<select tabindex="25" size="1" id="selectSchoolDistrict<?=$id; ?>" name="selectSchoolDistrict<?=$id; ?>">
			<option>Select...</option>
			<option></option>
			<?=$distSelect; ?>
			</select>
			-->
		</div>	
			
		<div style="float: left; width: 320px;">
			<div class="emphBox" id="metaInfo" style="font-size: 1em; width: 100%;">
				<div class="emphBoxInner">
					<input tabindex="36" type="checkbox" value="1" id="okToContact<?=$id; ?>" /> Ok to contact.
				</div>
			</div>	
		</div>	
		<div style="clear: left;"></div>		
		
		<div style="float: left; margin-top: 10px;">
			<div style="float: left; margin-right: 5px;">
				<a href="#" class="coolButton buttonBGBlueGray" tabindex="37" onClick="contactSaveFamilyTeamObj.saveTeamMember(<?=$id; ?>); return false;"><span class="update">Save</span></a>
			</div>
			<div style="float: left; display: none;" id="buttonDeleteMember<?=$id; ?>">
				<a href="#" class="coolButton buttonBGRed" tabindex="38" onClick="contactSaveFamilyTeamObj.deleteTeamMember(<?=$id; ?>,'member'); return false;" title="Delete this members' information"><span class="cancel">Delete</span></a>
			</div>
			<div style="clear: left;"></div>
		</div>	
		<div style="float: right; margin-top: 10px;">
			<div id="messageMember<?=$id; ?>"></div>
		</div>
		<div style="clear: both;"></div>
	</div>
</div>
<script type="text/javascript">
	contactFormSupportObj.addMemberTabElements(<?=$id; ?>);
	// Set activeMemberID
	contactFormSupportObj.setActiveMemberID(<?=$memberID; ?>);
	<? if (!empty($memberJSON)) { ?>
	contactFormGetInfoObj.returnGetMemberInformation(<?=$memberJSON; ?>,<?=$id; ?>);
	<? } ?>	
</script>